/**
 * \file  therapy_gen_imp.h
 * \brief Definition of TherapyGenImpl class.
 *
 * ASO: Antiviral Sequence Optimizer
 * <http://aso.googlecode.com/>
 * Copyright (C) 2010 Velez Ezequiel, Peralta Andres, FuDePAN
 *
 * This file is part of the ASO project.
 *
 * Contents:       Header file for ASO providing class TherapyGenImpl.
 *
 * System:         ASO
 * Language:       C++
 *
 * Author:         Velez Ezequiel, Peralta Andres
 * E-Mail:
 *
 * ASO is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * ASO is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with ASO.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#ifndef THERAPY_GEN_IMP_H
#define THERAPY_GEN_IMP_H

#include "aso-core/therapy_gen.h"
#include "aso-core/antiviral_selector.h"
#include "aso-core/combinatory_obs.h"
#include "aso-core/plugin_admin.h"

/*! Definición de clase TherapyGenImpl */
class TherapyGenImpl: public TherapyGen, private Observer<MutantObs>, private GenerationPolicy::ChildProcessor
{
private:
    Observer<Therapy>* rankerObs;
    AntiviralSet antivirals;                      //! conjunto de todos los antivirales disponibles
    GenerationPolicy* const generation;           //! Objeto que establece la política de generación
    const Score MIN_SCORE_VALUE;                  //! min score que puede tener una terapia
    const PluginAdmin* const pluginInterface;
    size_t currentId;

    /*! Implementa interfaz MutantsObserver */
    virtual void update(const MutantObs* m);
    /*! Implementa interfaz ChildProcessor */
    virtual Score process_node(const ChildId& id);
    virtual void discard_node(const ChildId& id);

public:
    /*! Constructor */
    TherapyGenImpl(Observer<Therapy>* rankerObs, AntiviralSet antivirals, const PluginAdmin* pluginInterface)
        : rankerObs(rankerObs), antivirals(antivirals), generation(pluginInterface->get_generation_policy()), MIN_SCORE_VALUE(pluginInterface->get_min_score()), pluginInterface(pluginInterface), currentId(0)
    {}

    /*! Destructor */
    ~TherapyGenImpl()
    {
        delete generation;
    }

    /*! Generar las terapias a partir de una secuencia. */
    virtual void generateTherapies(const biopp::PseudoNucSequence& initSequence);
};

#endif
